#include "StdAfx.h"
#include "interval_fence.h"
#include "tools.h"

interval_fence::interval_fence(void)
{
	rise = 0.0f;
	width_position_percent = 1.0f;
	height = 0.2f;
	radius = 0.01f;
}


interval_fence::~interval_fence(void)
{
}

void interval_fence::draw_element(float* position, float* delta, float* direction)
{
	float root[3];
	float top[3];
	root[0] = position[0] + width_position_percent*delta[0];
	root[1] = position[1] + width_position_percent*delta[1] + rise;
	root[2] = position[2] + width_position_percent*delta[2];
	top[0] = root[0]; 
	top[1] = root[1] + height;
	top[2] = root[2];

	draw_cylinder(top, root, radius, SECTION_DIRECTION_Y, true);

	root[0] = position[0] - width_position_percent*delta[0];
	root[1] = position[1] - width_position_percent*delta[1] + rise;
	root[2] = position[2] - width_position_percent*delta[2];
	top[0] = root[0]; 
	top[1] = root[1] + height;
	top[2] = root[2];

	draw_cylinder(top, root, radius, SECTION_DIRECTION_Y, true);
}
